const express = require('express');
const router = express.Router();
const { Category } = require('../models');
const { where } = require('sequelize');
const { failure, success } = require('../utils/responses');

//查询类别分类列表
router.get('/', async function (req, res) {
    try {
        const categories = await Category.findAll({
            order: [['rank', 'ASC'], ['id', 'DESC']]
        });
        success(res, '查询分类成功', categories)
    } catch (error) {
        failure(res, error)
    }
});

module.exports = router;
